<?php
if(!class_exists('PHPMailer')) include SERVER_PATH.'/extend/phpmailer/class.phpmailer.php';
class Email {
	public function send($to , $subject , $html) {
		$mail = new PHPMailer(true);
		$mail->IsSMTP();
		
		try {
		  	$mail->Host       = "smtp.gmail.com"; // SMTP server
		  	$mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
		  	$mail->SMTPAuth   = true;                  // enable SMTP authentication
		  	$mail->Port       = 26;                    // set the SMTP port for the GMAIL server
		  	$mail->Username   = "wisoch@hotmail.com"; // SMTP account username
		  	$mail->Password   = "wangchao28";        // SMTP account password
		  	$mail->AddAddress($to);
		  	$mail->Subject = $subject;
		  	$mail->MsgHTML($html);
		  	$mail->Send();
		  	return true;
		} catch (phpmailerException $e) {
			$error = $e->errorMessage();
			Log::write($error);
			return false;
		} catch (Exception $e) {
		  	$error = $e->getMessage();
			Log::write($error);
			return false;
		}
	}
}